ci(workflows): 同步 dev 分支工作流 - #637
Conversation
审查者指南本 PR 将 CI 的版本与更新日志管理切换为以 CHANGELOG.md 为唯一手写来源:贡献者署名通过共享解析器精确修改日志并重新生成版本信息,同时新增 PR 级别的一致性与必改文件检查,升级构建 Runtime 版本并移除旧版 JSON 校验工作流。 CHANGELOG 贡献者署名时序图sequenceDiagram
participant PR as Pull Request
participant Workflow as append-version-contributor
participant Parser as scripts/changelog.py
participant Changelog as CHANGELOG.md
participant Generated as Generated version files
Workflow->>Parser: parse_changelog(content)
Parser-->>Workflow: base and head entries
Workflow->>Workflow: Compare (version, category, item)
Workflow->>Parser: parse_changelog(CHANGELOG_PATH)
Parser-->>Workflow: current entries and dates
Workflow->>Changelog: write_text(CHANGELOG_PATH, render_changelog(...))
Workflow->>Parser: changelog.py sync
Parser->>Generated: Regenerate version information
Workflow->>Generated: git add generated files
Workflow-->>PR: Commit and push contributor attribution
PR 更新日志校验流程图flowchart TD
PR[Pull request opened or updated] --> Checkout[Checkout repository]
Checkout --> Setup[Set up Python 3.12]
Setup --> Check[python scripts/changelog.py check]
Check --> Files[Check PR file list]
Files --> Required{CHANGELOG.md changed?}
Required -->|Yes| Pass[Validation passes]
Required -->|No| Fail[Fail the PR check]
文件级变更
可能关联的问题
提示和命令与 Sourcery 交互
自定义你的使用体验访问你的控制面板以:
获取帮助Original review guide in EnglishReviewer's Guide本 PR 将 CI 的版本与更新日志管理切换为以 CHANGELOG.md 为唯一手写来源:贡献者署名通过共享解析器精确修改日志并重新生成版本信息,同时新增 PR 级别的一致性与必改文件检查,升级构建 Runtime 版本并移除旧版 JSON 校验工作流。 Sequence diagram for CHANGELOG contribution attributionsequenceDiagram
participant PR as Pull Request
participant Workflow as append-version-contributor
participant Parser as scripts/changelog.py
participant Changelog as CHANGELOG.md
participant Generated as Generated version files
Workflow->>Parser: parse_changelog(content)
Parser-->>Workflow: base and head entries
Workflow->>Workflow: Compare (version, category, item)
Workflow->>Parser: parse_changelog(CHANGELOG_PATH)
Parser-->>Workflow: current entries and dates
Workflow->>Changelog: write_text(CHANGELOG_PATH, render_changelog(...))
Workflow->>Parser: changelog.py sync
Parser->>Generated: Regenerate version information
Workflow->>Generated: git add generated files
Workflow-->>PR: Commit and push contributor attribution
Flow diagram for PR changelog validationflowchart TD
PR[Pull request opened or updated] --> Checkout[Checkout repository]
Checkout --> Setup[Set up Python 3.12]
Setup --> Check[python scripts/changelog.py check]
Check --> Files[Check PR file list]
Files --> Required{CHANGELOG.md changed?}
Required -->|Yes| Pass[Validation passes]
Required -->|No| Fail[Fail the PR check]
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
您好——我发现了 1 个问题
提供给 AI Agent 的提示
请处理本次代码审查中的评论:
## 单独评论
### 评论 1
<location path=".github/workflows/check-changelog.yml" line_range="48" />
<code_context>
+ # CHANGELOG.md 是唯一手写来源,res/version.json 与四处版本号都由它生成。
+ # 这一步同时校验更新日志格式、五处版本号一致、生成物是最新的。
+ - name: 检查更新日志格式与版本号一致性
+ run: python scripts/changelog.py check
+
+ - name: 检查 PR 文件列表
</code_context>
<issue_to_address>
**问题 (bug_risk):** 两个工作流都会调用或导入更新日志实现,但仓库中缺少 `scripts/changelog.py`,因此 PR 检查会因找不到文件而失败,合并后的贡献者任务也会在执行任何工作前因 `ModuleNotFoundError` 而失败。
**建议修复:** 添加 `scripts/changelog.py`(以及其导出的 `parse_changelog`、`render_changelog`、`read_text`、`write_text` 和 `CHANGELOG_PATH` API),或者更新两个工作流,使其引用实际的更新日志实现路径。
</issue_to_address>Sourcery 评估
需要人工审核。 有 1 个问题需要优先处理;如果更新日志解析器或生成版本同步存在错误,机器人可能会写入并推送错误的 CHANGELOG.md 和版本元数据,而运行时版本变更也可能影响构建产物。恢复工作流不会移除已经生成的提交或产物,但由此产生的变更范围有限,可以修复或重新生成。
阻塞性问题:.github/workflows/check-changelog.yml:48
Original comment in English
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path=".github/workflows/check-changelog.yml" line_range="48" />
<code_context>
+ # CHANGELOG.md 是唯一手写来源,res/version.json 与四处版本号都由它生成。
+ # 这一步同时校验更新日志格式、五处版本号一致、生成物是最新的。
+ - name: 检查更新日志格式与版本号一致性
+ run: python scripts/changelog.py check
+
+ - name: 检查 PR 文件列表
</code_context>
<issue_to_address>
**issue (bug_risk):** Both workflows invoke or import the changelog implementation, but `scripts/changelog.py` is absent from the repository, so the PR check fails with a file-not-found error and the post-merge contributor job fails with `ModuleNotFoundError` before performing any work.
**Suggested fix:** Add `scripts/changelog.py` (and its exported `parse_changelog`, `render_changelog`, `read_text`, `write_text`, and `CHANGELOG_PATH` APIs), or update both workflows to reference the actual changelog implementation path.
</issue_to_address>Sourcery assessment
Needs a human reviewer. 1 finding to address first, and if the changelog parser or generated-version sync is wrong, the bot can write and push incorrect CHANGELOG.md and version metadata, and the runtime-version change can affect built packages. Reverting the workflow will not remove commits or artifacts already produced, but the resulting changes are bounded and can be repaired or regenerated.
Blocking findings: .github/workflows/check-changelog.yml:48
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5697d9c1e7
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # CHANGELOG.md 是唯一手写来源,res/version.json 与四处版本号都由它生成。 | ||
| # 这一步同时校验更新日志格式、五处版本号一致、生成物是最新的。 | ||
| - name: 检查更新日志格式与版本号一致性 | ||
| run: python scripts/changelog.py check |
There was a problem hiding this comment.
Add the changelog tool before invoking it
For every opened or synchronized PR, this step checks out the reviewed tree and immediately runs a file that is not present: a repo-wide search of this commit finds neither scripts/changelog.py nor any changelog.py. The command therefore exits with [Errno 2] before performing any validation, making this required check fail for every PR; the same missing module also breaks the updated contributor workflow's import changelog and later sync invocation after merges.
Useful? React with 👍 / 👎.
| except subprocess.CalledProcessError: | ||
| print(f"{ref} 上没有 CHANGELOG.md,跳过对比") | ||
| return {} |
There was a problem hiding this comment.
Stop attribution when the base changelog cannot be loaded
When a merged PR's base commit has no CHANGELOG.md or its file cannot be parsed—as will happen for the first migration PR based on this commit, whose tree has no such file—returning {} does not skip the comparison. It makes every entry in the PR head appear newly added, so the later loop appends that PR author's suffix to every matching unsuffixed historical entry in the current changelog, corrupting contributor attribution; this path should terminate without making attribution changes instead.
Useful? React with 👍 / 👎.
| if (!files.some(file => file.filename === 'CHANGELOG.md')) { | ||
| core.setFailed('每个 PR 都必须包含对 CHANGELOG.md 的更改。'); |
There was a problem hiding this comment.
Align contributor instructions with the new changelog source
Once the missing tooling is supplied, this check makes CHANGELOG.md the required hand-edited file and rejects PRs that omit it, but the repository's mandatory engineering guidance still directs agents to update res/version.json itself. Contributors following that documented workflow will edit the generated artifact and have their PR rejected, so the source-of-truth migration needs to update the contributor instructions at the same time. .agents/skills/mas-skills/SKILL.mdL55-L55
Useful? React with 👍 / 👎.
Sourcery 总结
将 CI 工作流与基于变更日志的版本管理和贡献者署名流程同步。
新功能:
CHANGELOG.md,并验证从变更日志生成的版本构件是否已同步。错误修复:
改进:
CI:
Original summary in English
Sourcery 摘要
围绕 CHANGELOG.md 集中管理版本和发布元数据,并在整个 CI 和打包工作流中强制执行同步。
新功能:
错误修复:
增强功能:
CI:
Original summary in English
Summary by Sourcery
Centralize version and release metadata management around CHANGELOG.md and enforce its synchronization throughout CI and packaging workflows.
New Features:
Bug Fixes:
Enhancements:
CI: